package com.rolfhoward.video.record.ui;

import android.util.Size;

import java.util.Comparator;

/**
 * @author wuqiubin
 * @date 2022/10/26
 * @Describe
 */
public class CompareSizesByArea implements Comparator<Size> {
    @Override
    public int compare(Size lhs, Size rhs) {
        // 强转为long保证不会发生溢出
        return Long.signum((long) lhs.getWidth() * lhs.getHeight() -
                (long) rhs.getWidth() * rhs.getHeight());
    }
}
